package cn.edu.sdjzu.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j//
public class HelloController {
    @GetMapping("/hello")
    @SentinelResource(value = "hello_res",blockHandler = "blockHandler")
    public String hello(){
        log.info("hello666");
        return "hello";
    }
    public String blockHandler(BlockException ex){
        return "服务繁忙，请稍后";
    }
}
